package com.xxl.job.core.commons.vo.plugin;

import com.xxl.job.core.commons.annotation.SpaceCheck;
import com.xxl.job.core.config.ParameterConfig;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotNull;

/**
 * @author xuyue
 * @email xuyue@cetcbigdata.com
 * @date 2021-4-20 11:09\
 * 添加解析器vo
 */
@Data
@ApiModel(value = "com.xxl.job.admin.modules.plugin.vo.PluginAddVo", description = "添加DataX解析器输入参数")
public class PluginAddVo {

    @ApiModelProperty(value = "解析器名称")
    @NotNull(message = "解析器名称不能为空")
    @Length(max = ParameterConfig.PLUGIN_NAME_MAX_LENGTH, message = "解析器名称最大长度为" + ParameterConfig.PLUGIN_NAME_MAX_LENGTH)
    @SpaceCheck(message = "解析器名称不能包含空格")
    private String name;

    @ApiModelProperty(value = "解析器类型,reader或writer")
    @NotNull(message = "解析器类型不能为空")
    @Length(max = ParameterConfig.PLUGIN_TYPE_MAX_LENGTH, message = "解析器类型最大长度为" + ParameterConfig.PLUGIN_TYPE_MAX_LENGTH)
    private String type;

    @ApiModelProperty(value = "文件")
    private MultipartFile file;
}
